package com.jiukuaidao.zhulin.module.home.model;

import android.content.Context;

import com.jiukuaidao.library.net.IApi;
import com.jiukuaidao.zhulin.entity.ApiHomeAds;
import com.jiukuaidao.zhulin.entity.ApiHomePros;
import com.jiukuaidao.zhulin.entity.EventShoppingCartInfo;
import com.jiukuaidao.zhulin.module.home.contract.HomeContract;

import java.util.List;

/**
 * Author : H_Joker
 * Date : 2016/5/31
 * Description :
 */
public class HomeModel implements HomeContract.Model {

    private Context mContext;
    private int mCurPageIndex;
    private List<EventShoppingCartInfo> mShoppingCartDetail;
    private ApiHomePros.ApiHomeShop mShopInfo;

    /**
     * 商品列表
     */
    private List<ApiHomePros.ApiHomeProItem> mProList;

    /**
     * 运营位列表
     */
    private List<ApiHomeAds.ApiHomeActItem> mActList;

    /**
     * 轮播图列表
     */
    private List<ApiHomeAds.ApiHomeAdItem> mBannerList;

    public HomeModel(Context context) {
        mContext = context;
    }

    @Override
    public List<ApiHomePros.ApiHomeProItem> getProList() {
        return mProList;
    }

    @Override
    public List<ApiHomeAds.ApiHomeActItem> getActList() {
        return mActList;
    }

    @Override
    public List<ApiHomeAds.ApiHomeAdItem> getBannerList() {
        return mBannerList;
    }

    @Override
    public List<EventShoppingCartInfo> getShoppingCart() {
        return mShoppingCartDetail;
    }

    @Override
    public void setActList(List<ApiHomeAds.ApiHomeActItem> list) {
        mActList = list;
    }

    @Override
    public void setBannerList(List<ApiHomeAds.ApiHomeAdItem> list) {
        mBannerList = list;
    }

    @Override
    public void setProList(List list) {
        mProList = list;
    }

    @Override
    public void setCurPageIndex(int curPageIndex) {
        this.mCurPageIndex = curPageIndex;
    }

    @Override
    public void setShoppingCart(List<EventShoppingCartInfo> list) {
        mShoppingCartDetail = list;
    }

    @Override
    public void setShopInfo(ApiHomePros.ApiHomeShop shop) {
        mShopInfo = shop;

    }

    @Override
    public ApiHomePros.ApiHomeShop getShopInfo() {
        return mShopInfo;
    }

    @Override
    public int getCurPageIndex() {
        return mCurPageIndex;
    }

    @Override
    public void loadData(IApi api) {
        loadData(api, true);
    }

    @Override
    public void loadData(IApi api, boolean isBuildParams) {
        loadData(api, isBuildParams, false);
    }

    @Override
    public void loadData(IApi api, boolean isBuildParams, boolean aes) {
        if (isBuildParams)
            api.buildBaseParams();

        if (aes)
            api.aes();
        api.start();
    }

}
